<?php
/**
 *
 * @author griever
 * @version
 */
require_once 'Zend/Loader/PluginLoader.php';
require_once 'Zend/Controller/Action/Helper/Abstract.php';
require_once 'models/User.php';
require_once 'Base.php';

/**
 * CheckEmail Action Helper
 *
 * @uses actionHelper Custom_Helper
 */
class Custom_Helper_CheckEmail extends Dummy_Helper_Base
{

	public function checkEmail($email)	{
		$error = null;
		$emailAvai = User::IsEmailAvailable($email);
		if ($emailAvai === false)
		{
			$error = Message::EMAIL_NOT_AVAI;
		}
		return $error;
	}

	/**
	 * Strategy pattern: call helper as broker method
	 */
	public function direct($email){
		// TODO Auto-generated 'direct' method
		return $this->checkEmail($email);
	}
}

